<template>
    <div class="app-container">
        <!-- 顶部导航栏 -->
        <div class="nav-bar">
            <!-- <span class="back-btn" @click="goBack">←</span> -->
            <img src="@/assets/image/bak.png" alt="logo" class="Back-img" @click="goBack" />
            <span class="title">账号申请</span>
        </div>

        <!-- 表单内容 -->
        <form class="form" @submit.prevent="handleSubmit">
            <input class="input" type="text" placeholder="联系电话" v-model="form.phone" />

            <div class="input-group">
                <div class="wechat-dynamic">
                    <input class="input wechat-input" type="text" placeholder="微信号" v-model="form.wechat" />
                </div>
            </div>

            <input class="input" type="email" placeholder="电子邮箱" v-model="form.email" />

            <div class="row">
                <div class="col">
                    <input class="input" type="date" placeholder="生日" v-model="form.birthday" />
                </div>
                <div class="col">
                    <select class="input" placeholder="性别" v-model="form.gender">
                        <option value="男">男</option>
                        <option value="女">女</option>
                    </select>
                </div>
            </div>

            <div class="tip-text">
                *如您填写以上资料，我们将通过审核后给您发送注册信息，并且保证在您意愿的前提下进行登记处理！
            </div>

            <button class="submit-btn" type="submit" @click="handleSubmit">
                提交申请
            </button>

        </form>

        <div class="agreement">
            <input type="checkbox" v-model="form.agree" id="agree" />
            <label for="agree">同意《用户注册协议及隐私政策》</label>
        </div>
    </div>
</template>

<script setup>
import { ref } from 'vue'
import { useRouter } from 'vue-router'

const router = useRouter()
const form = ref({
    phone: '',
    wechat: '',
    email: '',
    birthday: '',
    gender: '男',
    agree: false
})

function goBack() {
    router.back()
}

function handleSubmit() {
    if (!form.value.agree) {
        alert('请先同意用户注册协议及隐私政策')
        return
    }
    console.log('form', form.value)
    // 这里可以添加表单提交逻辑
    // alert('提交成功！')
    router.push('/applicationOK')
}
</script>

<style scoped>
.app-container {
    background: #fff;
    min-height: 100vh;
    font-family: 'PingFang SC', 'Microsoft YaHei', Arial, sans-serif;
}

.nav-bar {
    display: flex;
    align-items: center;
    height: 48px;
    border-bottom: 1px solid #f0f0f0;
    padding: 0 50px 0 30px;
    position: relative;
}

.Back-img {
    width: 20px;
    height: 20px;
    /* position: absolute; */
    /* top: 10px; */
    /* left: 8px; */
    /* cursor: pointer; */
}

.back-btn {
    font-size: 20px;
    cursor: pointer;
    margin-right: 16px;
}

.title {
    flex: 1;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
}

.form {
    padding: 24px 16px 0 16px;
}

.input {
    width: 100%;
    height: 40px;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    padding: 0 16px;
    margin-bottom: 16px;
    font-size: 15px;
    box-sizing: border-box;
    outline: none;
}

.input-group {
    margin-bottom: 16px;
}

.input-label {
    font-size: 14px;
    color: #888;
    margin-right: 8px;
}

.wechat-dynamic {
    display: flex;
    align-items: center;
    position: relative;
}

.wechat-input {
    flex: 1;
}

.dynamic-tip {
    position: absolute;
    left: 80px;
    top: 0;
    height: 40px;
    line-height: 40px;
    background: #666;
    color: #fff;
    padding: 0 8px;
    border-radius: 4px;
    font-size: 14px;
    pointer-events: none;
}

.row {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.col {
    flex: 1;
}

.tip-text {
    color: #ff4d00;
    font-size: 13px;
    margin-bottom: 20px;
    line-height: 1.5;
}

.submit-btn {
    width: 100%;
    height: 44px;
    background: #ff7a3c;
    color: #fff;
    border: none;
    border-radius: 22px;
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    cursor: pointer;
}

.btn-icon {
    margin-left: 8px;
    font-size: 18px;
}

.agreement {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: auto;
    font-size: 14px;
    color: #888;
}

.agreement input[type="checkbox"] {
    margin-right: 6px;
}
</style>
